package jp.dev7.hongo2.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2011-08-03 21:50:03")
/** */
public final class QuestionMeta extends org.slim3.datastore.ModelMeta<jp.dev7.hongo2.model.Question> {

    /** */
    public final org.slim3.datastore.UnindexedAttributeMeta<jp.dev7.hongo2.model.Question, com.google.appengine.api.datastore.Text> content = new org.slim3.datastore.UnindexedAttributeMeta<jp.dev7.hongo2.model.Question, com.google.appengine.api.datastore.Text>(this, "content", "content", com.google.appengine.api.datastore.Text.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.dev7.hongo2.model.Question, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<jp.dev7.hongo2.model.Question, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question> selection0 = new org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question>(this, "selection0", "selection0");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question> selection1 = new org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question>(this, "selection1", "selection1");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question> selection2 = new org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question>(this, "selection2", "selection2");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question> selection3 = new org.slim3.datastore.StringAttributeMeta<jp.dev7.hongo2.model.Question>(this, "selection3", "selection3");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.dev7.hongo2.model.Question, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<jp.dev7.hongo2.model.Question, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final QuestionMeta slim3_singleton = new QuestionMeta();

    /**
     * @return the singleton
     */
    public static QuestionMeta get() {
       return slim3_singleton;
    }

    /** */
    public QuestionMeta() {
        super("Question", jp.dev7.hongo2.model.Question.class);
    }

    @Override
    public jp.dev7.hongo2.model.Question entityToModel(com.google.appengine.api.datastore.Entity entity) {
        jp.dev7.hongo2.model.Question model = new jp.dev7.hongo2.model.Question();
        model.setContent((com.google.appengine.api.datastore.Text) entity.getProperty("content"));
        model.setKey(entity.getKey());
        model.setSelection0((java.lang.String) entity.getProperty("selection0"));
        model.setSelection1((java.lang.String) entity.getProperty("selection1"));
        model.setSelection2((java.lang.String) entity.getProperty("selection2"));
        model.setSelection3((java.lang.String) entity.getProperty("selection3"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        jp.dev7.hongo2.model.Question m = (jp.dev7.hongo2.model.Question) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setUnindexedProperty("content", m.getContent());
        entity.setProperty("selection0", m.getSelection0());
        entity.setProperty("selection1", m.getSelection1());
        entity.setProperty("selection2", m.getSelection2());
        entity.setProperty("selection3", m.getSelection3());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        jp.dev7.hongo2.model.Question m = (jp.dev7.hongo2.model.Question) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        jp.dev7.hongo2.model.Question m = (jp.dev7.hongo2.model.Question) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        jp.dev7.hongo2.model.Question m = (jp.dev7.hongo2.model.Question) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        jp.dev7.hongo2.model.Question m = (jp.dev7.hongo2.model.Question) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        jp.dev7.hongo2.model.Question m = (jp.dev7.hongo2.model.Question) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getContent() != null && m.getContent().getValue() != null){
            writer.setNextPropertyName("content");
            encoder0.encode(writer, m.getContent());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getSelection0() != null){
            writer.setNextPropertyName("selection0");
            encoder0.encode(writer, m.getSelection0());
        }
        if(m.getSelection1() != null){
            writer.setNextPropertyName("selection1");
            encoder0.encode(writer, m.getSelection1());
        }
        if(m.getSelection2() != null){
            writer.setNextPropertyName("selection2");
            encoder0.encode(writer, m.getSelection2());
        }
        if(m.getSelection3() != null){
            writer.setNextPropertyName("selection3");
            encoder0.encode(writer, m.getSelection3());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    protected jp.dev7.hongo2.model.Question jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        jp.dev7.hongo2.model.Question m = new jp.dev7.hongo2.model.Question();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("content");
        m.setContent(decoder0.decode(reader, m.getContent()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("selection0");
        m.setSelection0(decoder0.decode(reader, m.getSelection0()));
        reader = rootReader.newObjectReader("selection1");
        m.setSelection1(decoder0.decode(reader, m.getSelection1()));
        reader = rootReader.newObjectReader("selection2");
        m.setSelection2(decoder0.decode(reader, m.getSelection2()));
        reader = rootReader.newObjectReader("selection3");
        m.setSelection3(decoder0.decode(reader, m.getSelection3()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        return m;
    }
}